﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlServerCe;
using System.Windows.Forms;
using Scan.PDAService;
using Scan.DAO;

namespace Scan
{
    class ArchivesComputationUnit
    {
        public static ComputationUnit[] GetComputationUnit(string UnitCode, string GroupCode)
        {
            if (Configuration.Instance.OnLineType == OnLineType.Online)
            {   // 在线方式

                //执行 WebService 方法
                ResponseBaseOfComputationUnit response = GlobalCache.Instance.WebServiceIfe.GetComputationUnit(UnitCode, GroupCode);
                if (response.ErrorInfo.ErrorCode == 1)
                {
                    if (response.Lists != null || response.Lists.Length != 0)
                    {
                        return response.Lists;
                    }
                    else
                    {
                        return null;
                    }
                }
                else
                {
                    MessageBox.Show(response.ErrorInfo.ErrorMsg, "获取商品档案出错！");
                    return null;
                }
            }
            else
            {   // 离线方式
                string sSQL = "select cInvCode, cInvName, cInvStd, cInvType, cBarCode, cUnitCode, cUnitName, cAssitUnitCode, "
                            + "cAssitUnitName, iAssitUnitRate, iRetailPrice, iLowSalePrice, iRectInPrice, iRectOutPrice from Inventorys";
                return null;
            }
        }
    }
}
